package org.luxor.accesslog.config;

import org.springframework.boot.context.properties.ConfigurationProperties;

/**
 * 访问审计日志配置项
 *
 * @author Mr.yan @date 2020/3/22
 */
@ConfigurationProperties(prefix = AccessLogProperties.PREFIX)
public class AccessLogProperties {
    public static final String PREFIX = "luxor.accesslog";

    private final Boolean DEFAULT_ENABLED = Boolean.TRUE;
    private final String DEFAULT_INDEX_NAME = "access_log";
    private final Long DEFAULT_TIME_TO_LIVE = 15 * 24 * 60 * 60 * 1L;

    /**
     * 是否启用
     */
    private boolean enabled;

    /**
     * 访问升级日志索引名
     */
    private String indexName;

    /**
     * 日志保留时长(单位:秒)
     */
    private Long ttlSec;

    public AccessLogProperties() {
        this.enabled = DEFAULT_ENABLED.booleanValue();
        this.indexName = DEFAULT_INDEX_NAME;
        this.ttlSec = DEFAULT_TIME_TO_LIVE;
    }

    public boolean isEnabled() {
        return enabled;
    }

    public void setEnabled(boolean enabled) {
        this.enabled = enabled;
    }

    public String getIndexName() {
        return indexName;
    }

    public void setIndexName(String indexName) {
        this.indexName = indexName;
    }

    public Long getTtlSec() {
        return ttlSec;
    }

    public void setTtlSec(Long ttlSec) {
        this.ttlSec = ttlSec;
    }
}
